package igiant.order.provider.service.util;


import igiant.common.core.util.UUIDUtils;
import igiant.order.facade.entity.Order;
import igiant.order.facade.entity.OrderGroup;
import igiant.order.facade.entity.OrderItem;

/**
 * OrderUtil
 *
 * @author zrd
 * @date 2016/8/31
 */
public class OrderUtil {
    public static OrderGroup initOrderGroup(){
        OrderGroup orderGroup = new OrderGroup();
        orderGroup.setId(UUIDUtils.getUUID());
        orderGroup.setCreateTime(DateUtil.randomDate("2016-01-01", "2017-12-22"));
        return orderGroup;
    }

    public static Order initOrder(OrderGroup orderGroup){
        Order order = new Order();
        order.setId(UUIDUtils.getUUID());
        order.setGroupId(orderGroup.getId());
        order.setCreateTime(DateUtil.randomDate("2016-01-01", "2017-12-22"));
        return order;
    }

    public static OrderItem initOrderItem(Order order){
        OrderItem orderItem = new OrderItem();
        orderItem.setId(UUIDUtils.getUUID());
        orderItem.setOrderId(order.getId());
        orderItem.setCreateTime(DateUtil.randomDate("2016-01-01", "2017-12-22"));
        return orderItem;
    }
}
